package com.wf.atm.config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author mpk
 * @since 2024/6/18 10:03:44
 */
public   class ThreadPoolConfig {

    public static int CORE_POOL_SIZE;
    public static int MAX_POOL_SIZE;
    public static int QUEUE_SIZE;

    public  static  int MAX_CLIENTS;

    static {
        loadConfig();
    }
    public static void loadConfig() {
        InputStream inputStream = ThreadPoolConfig.class.getResourceAsStream("threadPool.properties");

        Properties properties = new Properties();
        try {
            properties.load(inputStream);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        CORE_POOL_SIZE = Integer.parseInt((String) properties.get("CORE_POOL_SIZE"));
        MAX_POOL_SIZE = Integer.parseInt((String) properties.get("MAX_POOL_SIZE"));
        QUEUE_SIZE = Integer.parseInt((String) properties.get("QUEUE_SIZE"));

        MAX_CLIENTS=MAX_POOL_SIZE+QUEUE_SIZE;


    }


}
